<?php
/**
 * communit.as
 * @copyright (C)2008 J. William McCarthy, All Rights Reserved.
 * @category communitas
 * @package communitas
 * @author J. William McCarthy
 * @link http://communit.as communit.as
 * @license http://communit.as/docs/license License
 */

/**
 *
 * @package communitas
 * @subpackage forum_models
 * @license http://communit.as/docs/license License 
 */
 
class Forums extends App_Db_Table_Abstract
{
    protected $_name 	= 'forum_forums';
    protected $_primary = 'id';
    
	public function delete($where){
    	$topics_table = new Topics();
    	$forums = $this->fetchAll($where);
    	if(count($forums) > 0){
	    	foreach($forums as $forum){
	    		$topics_where = $this->getAdapter()->quoteInto('forum_id = ?',$forum->id);
	    		$topics_table->delete($topics_where);    		
	    	}
    	}
    	return parent::delete($where);
    } 
    
    
}